 var xmlhttp;
 var hdnResultId;
 var readyFunction;
 var elementoDiv;

function loadContent(param,action,url,hdnId,functionName,paramAux)
{

 xmlhttp=GetXmlHttpObject();
 hdnResultId = hdnId;
 readyFunction = functionName;

  if (xmlhttp==null)
  {
   window.status="Erro ao carregar AJAX.";
   return;
  }

    url=url+"?q="+param;
    url=url+"&action="+action;
    url=url+"&aux="+paramAux;
    
    xmlhttp.onreadystatechange = getOutput;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function carregarInf(url,action,div,param){
      xmlhttp=GetXmlHttpObject();
      elementoDiv = div;

      if (xmlhttp==null)
      {
           window.status="Erro ao carregar AJAX.";
           return;
      }

        url=url+"?q="+param;
        url=url+"&action="+action;
       
        xmlhttp.onreadystatechange = enviarInf;
        xmlhttp.open("GET",url,true);
        xmlhttp.send(null);
}

function enviarInf(){
    if (xmlhttp.readyState==4)
      {
        elementoDiv.innerHTML = xmlhttp.responseText;

      }
}

function getOutput()
{
      if (xmlhttp.readyState==4)
      {
        document.getElementById(hdnResultId).value = xmlhttp.responseText;
        eval(readyFunction + "();");
      }
}

function GetXmlHttpObject()
{
    if (window.XMLHttpRequest)
    {
       return new XMLHttpRequest();
    }
    if (window.ActiveXObject)
    {
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
 return null;
}